# Maintainer: Antonio Rojas <arojas@archlinux.org>

pkgname=falkon
pkgver=3.0.1
pkgrel=5
pkgdesc="Cross-platform QtWebEngine browser"
arch=(x86_64)
url="https://www.falkon.org/"
license=(GPL3)
depends=(qt5-webengine qt5-x11extras qt5-svg)
makedepends=(extra-cmake-modules qt5-tools kwallet libgnome-keyring python-pyside2 pyside2 shiboken2)
optdepends=('kwallet: kf5 kwallet integration' 'libgnome-keyring: gnome keyring integration'
            'python-pyside2: Python plugins')
replaces=(qupzilla)
source=(https://download.kde.org/stable/$pkgname/$pkgver/$pkgname-$pkgver.tar.xz{,.sig}
        falkon-pyside2.patch::"https://cgit.kde.org/falkon.git/patch/?id=4c83ba3d"
        falkon-webinspector.patch::"https://cgit.kde.org/falkon.git/patch/?id=48ca42d6")
sha256sums=('7b6ed54986543dd5462602943fb824df12f15d2061996310c4c4b891433f1a83'
            'SKIP'
            'c4d67973fb6d56cb62d0df819fb21232df51b11c13ff52bcf47d89448bc31d4e'
            '764a2829d8a4a9da875abe48d1c3f195b090bedc764c59f00b16e6ab753ee089')
validpgpkeys=(3CB7B8416EF6778B409FDC43EBC3FC294452C6D8) # David Rosca <nowrep@gmail.com>

prepare() {
  mkdir -p build

  cd $pkgname-$pkgver
  patch -p1 -i ../falkon-pyside2.patch # Fix build with Pyside2 5.11.0
  patch -p1 -i ../falkon-webinspector.patch # Fix WebInspector with Qt 5.11
}

build() {
  cd build
  cmake ../$pkgname-$pkgver \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_INSTALL_LIBDIR=lib \
    -DBUILD_TESTING=OFF
  make
}

package() {
  cd build
  make DESTDIR="$pkgdir" install
}
